#include <iostream>
using namespace std;
const int Mo=41;
int arr[Mo][Mo];
int main()
{
	int N=0;
	cin>>N;
	arr[0][N/2]=1;
	int prex=0,prey=N/2;
	for(int i=2;i<=N*N;i++)
	{
		//cout<<"i:"<<i<<"prex:"<<prex<<"prey:"<<prey<<endl;
		if(prex==0&&prey!=N-1)
		{
			arr[N-1][prey+1]=i;
			prex=N-1;
			prey++;
		}
		else if(prey==N-1&&prex!=0)
		{
			arr[prex-1][0]=i;
			prex--;
			prey=0;
		}
		else if(prex==0&&prey==N-1)
		{
			arr[prex+1][prey]=i;
			prex++;
		}
		else if(prex!=0&&prey!=N-1&&arr[prex-1][prey+1]==0)
		{
			arr[prex-1][prey+1]=i;
			prex--;
			prey++;
	
		}
		else
		{
			arr[prex+1][prey]=i;
			prex++;
		}
	}
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<N;j++)
		{
			cout<<arr[i][j]<<' ';
		}
		cout<<endl;
	}
	return 0;
}
